<template>
  <div class="mask-black-dialog">
    <div class="m-pop">
      <template>
        <div class="pop-hd" v-if="title">
          <div class="pop-icon"><span class="k-block"></span></div>
          <div class="pop-title" v-html="title"></div>
        </div>
        <div class="pop-hd-1 k-block" v-else>
        </div>
      </template>

      <div class="pop-bd" v-html="mes" :class="{nopadding: tip}"></div>
      <template v-if="typeof opts == 'function'">
        <div class="pop-ft">
          <a href="javascript:;" class="pop-btn primary" @click.stop="closePop(false, opts)">确定</a>
          <a href="javascript:;" class="pop-btn default" @click.stop="closePop(false)">取消</a>
        </div>
      </template>
      <template v-else>
        <div class="pop-ft" :class="{'bigBtn': tip}">
          <a href="javascript:;"  class="pop-btn" v-for="(item, index) in opts" :key='index' :class="typeof item.color == 'boolean' ? (item.color ? 'primary' : 'default') : ''"  :style="{color: item.color}" @click.stop="closePop(item.stay, item.callback)">{{item.txt}}</a>
        </div>
      </template>
    </div>
  </div>
</template>

<script type="text/babel">
  export default {
    props: {
      title: String,
      mes: String,
      tip: {
        type: Boolean,
        default: false
      },
      opts: {
        type: [Array, Function],
        default: () => {
        }
      }
    }
  }
</script>
<style lang="less">
  .no-car{
    border-bottom: 1px solid #e8e5e5;/*no*/
    border-top: 1px solid #e8e5e5;/*no*/
    padding: 4px 0 20px 0;
    color: #a5a5a5;
    font-size: 28px;/*px*/
    font-weight: 400;
    width: 100%;
  }
  .invalid{
    color: #000;
    font-size: 32px;/* px */
  }
 .goods-list{
   width: 100%;
   color: #a5a5a5;
   font-size: 28px;/*px*/
   padding: 40px 80px;
   overflow-y: auto;
   text-align: left;
   font-weight: 400;
   max-height: 300px;/*px*/
 }
</style>
<style lang="less" scoped>
  @keyframes myshow {
    from {
      transform: scale(0, 0);
    }
    to {
      transform: scale(1, 1);
    }
  }

  .m-pop {
    width: 90%;
    min-height: 300px;
    background: #FFFFFF;
    border-radius: 12px;
    font-size: 30px;/*px*/
    animation: myshow .5s;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
  }

  .pop-title {
    font-size: 36px;/*px*/
    color: #404040;
    text-align: center;
    border-radius: 10px;
    flex:1;
    display: flex;
    justify-content: center;
    padding-top: 10px;
    font-weight:600;
  }

  .k-block{
    font-size: 100px;/*px*/
    bottom: 0;
  }

  .pop-icon{
    display: flex;
    justify-content: center;
    position: absolute;
    top: 0;
    overflow: hidden;
    transform: rotate(180deg);
    width: 120px;
    left: 50%;
    margin-left: -60px;
    height:20px;
  }

  .pop-hd {
    height: 110px;
    line-height: 110px;
    text-align: center;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid #dfdfdf;/*no*/
    position: relative;
    margin: 0 10px;
  }

  .pop-hd-1 {
    border-radius: 10px;
    height: 20px;
    text-align: center;
    position: relative;
    &.k-block{
      font-size: 100px;/*px*/
    }
  }
  .tip{
    color: #000;
    text-align:center;
    font-size: 32px;/*px*/
    font-weight: 700;
    padding: 10px 0 0 0;
    border-bottom: 2px solid #efefef;/* px */
  }

  .pop-bd {
    font-size: 32px;
    /* px */
    word-break: break-all;
    flex: 1;
    padding: 40px 40px 0 40px;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    color: #404040;
    line-height: 48px;
    max-height: 800px;
    overflow-y: auto;
    &.nopadding{
      padding: 0;
    }
  }

  .pop-ft {
    color: #FFF;
    height: 100px;
    line-height: 100px;
    font-size: 32px;/* px */
    border-radius: 0 0 12px 12px;
    position: relative;
    margin: 40px;
    display: flex;
    justify-content: space-between;
    >a {
      position: relative;
      text-align: center;
      display: block;
      width: 244px;
      line-height: 90px;
      height: 90px;
      border-radius: 10px;
      &.pop-btn.primary {
        background-color: #95b04c;
        border-radius: 10px;
        box-shadow: 0 0 6px rgba(0, 0, 0, .2);
        border: 1px solid #95b04c;/* no */
        color: #fff;
        flex: 1;
      }
    }
  &.bigBtn{
    margin-top: 0;
    >a {
      width:512px;
    }
  }
}
</style>
